package com.erp.generator.util;


public class TableToClassUtil {

    /**
     * 数据表名转为对象名
     * @param field
     * @return
     */
    public static String changeToJavaFiled(String field){
        String[] fields = field.split("_");
        StringBuilder sbuilder = new StringBuilder();
        sbuilder.append(fields[0]);
        for (int i = 1; i < fields.length; i++) {
            char[] cs=fields[i].toCharArray();
            cs[0]-=32;
            sbuilder.append(String.valueOf(cs));
        }
        return sbuilder.toString();
    }

    /**
     * 数据表名转为类名
     * @param field
     * @return
     */
    public static String changeToClassName(String field){
        String[] fields = field.split("_");
        StringBuilder sbuilder = new StringBuilder();
        for (int i = 0; i < fields.length; i++) {
            char[] cs=fields[i].toCharArray();
            cs[0]-=32;
            sbuilder.append(String.valueOf(cs));
        }
        return sbuilder.toString();
    }
}
